import { onMounted } from 'vue'

const mainOut = window.electronAPI.mainOut
//promise
const myPromise = (callback) => {
  return new Promise((resolve) => {
    callback((result) => {
      resolve(result)
    })
  })
}

export const initData = async (SqliteData) => {
  //获取classList列表
  await window.electronAPI.rendererSend('getCalss')
  await myPromise((callback) => {
    mainOut(callback)
  }).then((res) => {
    let {
      data: {
        data: { list }
      }
    } = res
    console.log(res)
    SqliteData.setClassList(list)
    //获取班级排名数据
  })
}
